home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Prog / M / MPWGCC (Sources).cpt / Sources / stdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-15  |  876 b   |  32 lines  |  [TEXT/MPS ]

  1. /*   Copyright (C) 1989, 1990 Apple Computer, Inc.  */
  2. #ifndef _STDARG_H
  3. #define _STDARG_H
  4.  
  5. typedef char *va_list;
  6.  
  7. /* Amount of space required in an argument list for an arg of type TYPE.
  8.    TYPE may alternatively be an expression whose type is used.  */
  9.  
  10. #define __va_rounded_size(TYPE)  \
  11.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  12.  
  13. #ifndef __sparc__
  14. #define va_start(AP, LASTARG)                         \
  15.  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  16. #else
  17. #define va_start(AP, LASTARG)                         \
  18.  (__builtin_saveregs (),                        \
  19.   AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  20. #endif
  21.  
  22. #ifndef APPLE_HAX
  23. void va_end (va_list);        /* Defined in gnulib */
  24. #endif /* APPLE_HAX */
  25. #define va_end(AP)
  26.  
  27. #define va_arg(AP, TYPE)                        \
  28.  (AP += __va_rounded_size (TYPE),                    \
  29.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  30.  
  31. #endif /* _STDARG_H */
  32.